package cn.itcast.hotel.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

@Data
@TableName("tb_hotel")
public class Hotel {
    @TableId(type = IdType.INPUT)
    private Long id;
    private String name;
    private String address;
    private Integer price;
    private Integer score;
    private String brand;
    private String city;
    private String starName;
    private String business;
    private String longitude;
    private String latitude;
    private String pic;

    private void Hotel(HotelDoc hotelDoc){
        if (hotelDoc.getLocation () != null){
            String[] split = hotelDoc.getLocation ().split (",");
            this.longitude = split[1];
            this.latitude = split[0];
        }
        this.id = hotelDoc.getId();
        this.name = hotelDoc.getName();
        this.address = hotelDoc.getAddress();
        this.price = hotelDoc.getPrice();
        this.score = hotelDoc.getScore();
        this.brand = hotelDoc.getBrand();
        this.city = hotelDoc.getCity();
        this.starName = hotelDoc.getStarName();
        this.business = hotelDoc.getBusiness();
        this.pic = hotelDoc.getPic ();
    }

}
